<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />

<!DOCTYPE html>
<!--[if IE 8]> <html lang="zh-cmn-Hans" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="zh-cmn-Hans" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="zh-cmn-Hans">
<!--<![endif]-->

<head>
    <meta charset="utf-8" />
    <title>报名信息管理</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1" name="viewport" />
    <meta content="" name="description" />
    <meta content="" name="author" />
    <link href="${ctx}/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <link href="${ctx}/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
    <link href="${ctx}/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />

    <link href="${ctx}/assets/global/css/components-rounded.min.css" rel="stylesheet" id="style_components" type="text/css" />
    <link href="${ctx}/assets/layouts/layout/css/layout.min.css" rel="stylesheet" type="text/css" />
    <link href="${ctx}/assets/layouts/layout/css/themes/darkblue.min.css" rel="stylesheet" type="text/css" id="style_color" />

    <!-- 插件 -->
    <link href="${ctx}/assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
    <link href="${ctx}/assets/global/plugins/bootstrap-toastr/toastr.min.css" rel="stylesheet" type="text/css" />
    <!-- 自定义样式 -->
    <link href="${ctx}/assets/pages/css/app.css" rel="stylesheet" type="text/css" />

    <link rel="shortcut icon" href="favicon.ico" />
    <style type="text/css">
        #nopadding {
            padding: 0 !important;    /* id优先级高于class 覆盖所有媒体查询 */
        }
        /* 箭头向右 */
        .page-sidebar .page-sidebar-menu > li.active > a > .selected, .page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu > li.active > a > .selected {
            top: 0;
            right: -8px;
            border-top: 20px double transparent;
            border-bottom: 20px double transparent;
            border-right: 0;
            border-left: 8px solid #D64635;
        }
        /* 箭头向右（折叠后） */
        .page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed > li > a .selected {
            right: -8px !important;
        }
        /* 左侧菜单选中颜色（#D64635） */
        .page-sidebar .page-sidebar-menu > li.active.open > a:hover, .page-sidebar .page-sidebar-menu > li.active > a:hover, .page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu > li.active.open > a:hover, .page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu > li.active > a:hover {
            background-color: #D64635;
        }
        .page-sidebar .page-sidebar-menu > li.active.open > a, .page-sidebar .page-sidebar-menu > li.active > a, .page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu > li.active.open > a, .page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu > li.active > a {
            background: #D64635;
            border-top-color: transparent;
            color: #FFFFFF;
        }
        .bootbox .close {
            margin-top: 0 !important;
        }
        .font-grey-666 {
            color: #666;
        }
        .portlet.light > .portlet-title > .caption > i {
            margin-top: 5px;
        }
        .change-password-alert-danger {
            background-color:#fbe1e3;
            border-color:#fbe1e3;color:#e73d4a
        }
    </style>
</head>

<body class="page-header-fixed page-sidebar-closed-hide-logo page-content-white">   <!-- 固着 page-header-fixed -->
<div class="page-header navbar navbar-fixed-top">   <!-- 固着顶部 navbar-fixed-top -->
    <div class="page-header-inner ">
        <div class="page-logo">
            <%--<a href="#">--%>
                <%--<img src="${ctx}/assets/layouts/layout/img/crm_logo.png" alt="logo" class="logo-default" /> </a>--%>
            <div class="menu-toggler sidebar-toggler" title="折叠/展开菜单">
                <span></span>
            </div>
        </div>
        <a href="javascript:;" class="menu-toggler responsive-toggler" data-toggle="collapse" data-target=".navbar-collapse">
            <span></span>
        </a>
        <div class="top-menu">
            <ul class="nav navbar-nav pull-right">
                <%--<li class="dropdown dropdown-extended dropdown-notification hidden" id="header_notification_bar">--%>
                    <%--<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">--%>
                        <%--<i class="icon-bell"></i>--%>
                        <%--<span id="unconfirmed_order_count" class="badge badge-default"> 0 </span>--%>
                    <%--</a>--%>
                    <%--<ul class="dropdown-menu">--%>
                        <%--<li>--%>
                            <%--<ul class="dropdown-menu-list scroller" style="height: 250px;" data-handle-color="#637283">--%>
                                <%--<li id="notice_hotel_order" class="hidden">--%>
                                    <%--<a href="javascript:;">--%>
                                        <%--<span class="time" onclick="confirmOrderNotice(this)">知道了</span>--%>
                                        <%--<span class="details">--%>
                                        <%--<span class="label label-sm label-icon label-warning">--%>
                                            <%--<i class="fa fa-bell-o"></i>--%>
                                        <%--</span> 酒店订单 <span class="badge badge-default"> 0 </span> 条待确认 </span>--%>
                                    <%--</a>--%>
                                <%--</li>--%>
                                <%--<li id="notice_product_order" class="hidden">--%>
                                    <%--<a href="javascript:;">--%>
                                        <%--<span class="time" onclick="confirmOrderNotice(this)">知道了</span>--%>
                                        <%--<span class="details">--%>
                                        <%--<span class="label label-sm label-icon label-warning">--%>
                                            <%--<i class="fa fa-bell-o"></i>--%>
                                        <%--</span> 房源订单 <span class="badge badge-default"> 0 </span> 条待确认 </span>--%>
                                    <%--</a>--%>
                                <%--</li>--%>
                            <%--</ul>--%>
                        <%--</li>--%>
                    <%--</ul>--%>
                <%--</li>--%>
                <%--<li class="dropdown dropdown-user">--%>
                    <%--<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">--%>
                        <%--&lt;%&ndash;<img alt="" class="img-circle" src="" />&ndash;%&gt;--%>
                        <%--<span class="username username-hide-on-mobile"> ${sessionScope.user.loginName} </span>--%>
                        <%--<i class="fa fa-angle-down"></i>--%>
                    <%--</a>--%>
                    <%--<ul class="dropdown-menu dropdown-menu-default">--%>
                        <%--<li>--%>
                            <%--<a href="javascript:changePassword()"> <i class="icon-lock-open"></i> 修改密码 </a>--%>
                        <%--</li>--%>
                    <%--</ul>--%>
                <%--</li>--%>
                <li class="dropdown dropdown-quick-sidebar-toggler">
                    <a href="javascript:logout();" class="dropdown-toggle" title="退出登陆">
                        <i class="icon-logout"></i><span style="color: white;margin-left: 5px;">注销</span>
                    </a>
                </li>
            </ul>
        </div>
    </div>
</div>
<div class="clearfix"></div>
<div class="page-container">
    <!-- BEGIN SIDEBAR -->
    <div class="page-sidebar-wrapper">
        <div class="page-sidebar navbar-collapse collapse">
            <ul class="page-sidebar-menu page-header-fixed " data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200" style="padding-top: 20px">
                <li class="sidebar-toggler-wrapper hide">
                    <div class="sidebar-toggler">
                        <span></span>
                    </div>
                </li>
                <li class="nav-item start">
                    <a href="${ctx}/back/index" class="nav-link ">
                        <i class="fa fa-book"></i>
                        <span class="title">报名信息</span>
                    </a>
                </li>
            </ul>
        </div>
    </div>
    <div class="page-content-wrapper">
        <div class="page-content" id="nopadding">

        </div>
    </div>
    <a href="javascript:;" class="page-quick-sidebar-toggler">
        <i class="icon-login"></i>
    </a>
</div>
<div class="page-footer">
    <div class="page-footer-inner"> 2017 &copy; TJ.Next
    </div>
    <div class="scroll-to-top">
        <i class="icon-arrow-up"></i>
    </div>
</div>

<div class="modal fade" id="change_password_modal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" style="font-size: 16px; color: #555;"> <i class="fa fa-unlock-alt"></i> 修改密码</h4>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-md-12">
                        <form action="#" id="change_password_modal_form" class="form-horizontal">
                            <div class="form-body">
                                <div class="alert change-password-alert-danger display-hide" style="padding-bottom: 10px;" data-category="errorMessage">
                                    <div id="change_password_modal_server_error_message"></div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        <span class="required"> * </span> 原密码
                                    </label>
                                    <div class="col-md-7">
                                        <input type="password" id="old_password" name="old_password" class="form-control"
                                               data-rule-minlength="6" data-msg-minlength="“原密码”不能少于6个字符"
                                               data-rule-maxlength="24" data-msg-maxlength="“原密码”不能超过24个字符"
                                               data-rule-required="true" data-msg-required="“原密码”不能为空" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        <span class="required"> * </span> 新密码
                                    </label>
                                    <div class="col-md-7">
                                        <input type="password" id="new_password" name="new_password" class="form-control"
                                               data-rule-minlength="6" data-msg-minlength="“新密码”不能少于6个字符"
                                               data-rule-maxlength="24" data-msg-maxlength="“新密码”不能超过24个字符"
                                               data-rule-required="true" data-msg-required="“新密码”不能为空" />
                                        <span class="help-block"> 长度：6 ~ 24 位，英文字母区分大小写 </span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        <span class="required"> * </span> 重复新密码
                                    </label>
                                    <div class="col-md-7">
                                        <input type="password" id="new_password2" name="new_password2" class="form-control"
                                               data-rule-minlength="6" data-msg-minlength="“重复新密码”不能少于6个字符"
                                               data-rule-maxlength="24" data-msg-maxlength="“重复新密码”不能超过24个字符"
                                               data-rule-required="true" data-msg-required="“重复新密码”不能为空"
                                               data-rule-equalto="#new_password" data-msg-equalto="“重复新密码”输入不一致" />
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-outline btn-circle blue" data-dismiss="modal"><i class="fa fa-close"></i> 关闭</button>
                <button type="button" class="btn btn-outline btn-circle green-meadow" onclick="changePasswordSubmit()"><i class="fa fa-check"></i> 确定</button>
            </div>
        </div>
    </div>
</div>

<!--[if lt IE 9]>
<script src="${ctx}/assets/global/plugins/respond.min.js"></script>
<script src="${ctx}/assets/global/plugins/excanvas.min.js"></script>
<![endif]-->
<script src="${ctx}/assets/layouts/js/jquery.min.js" type="text/javascript"></script>
<script src="${ctx}/assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="${ctx}/assets/global/scripts/app.min.js" type="text/javascript"></script>   <!-- 窗口高度 -->
<script src="${ctx}/assets/layouts/layout/scripts/layout.min.js" type="text/javascript"></script>   <!-- 窗口高度 -->
<!-- <script src="${ctx}/assets/layouts/layout/scripts/demo.min.js" type="text/javascript"></script> 更换主题的按钮 -->

<!-- 插件 -->
<script src="${ctx}/assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<script src="${ctx}/assets/global/plugins/bootstrap-toastr/toastr.min.js" type="text/javascript"></script>
<script src="${ctx}/assets/global/plugins/bootbox/bootbox.min.js" type="text/javascript"></script>
<script src="${ctx}/assets/global/plugins/jquery-validation/js/jquery.validate.js" type="text/javascript"></script>
<!-- 自定义 -->
<script src="${ctx}/assets/pages/scripts/app.js"></script>

<script type="text/javascript">

    $(function() {
        initMenu();
//        changePasswordCheck();
//        noticeUnconfirmedOrder();
    });

    function initMenu() {
        var firstUrl = "index";
        Layout.setSidebarMenuActiveLink('set', $(".nav-link[href='"+ firstUrl +"']"));
        $(".page-content").load(firstUrl);

        $(".nav-link").click(function(e) {
            e.preventDefault();
            var href = $(this).attr("href");
            if (href != "javascript:;") {
                Layout.setSidebarMenuActiveLink('set', $(this));
                $(".page-content").load(href);
            }
        });
    }

    function logout() {
        bootbox.confirm(getConfirm("确定要退出系统吗？", function() {
            document.location.href = "${ctx}/back/logout";
        }));
    }

    // 修改密码时的验证
    function changePasswordCheck() {
        $("#change_password_modal_form").validate({
            errorContainer: ".change-password-alert-danger",
            highlight: function(element) {
                $(element).closest('.form-group').removeClass('has-error').addClass('has-error');
            },
            unhighlight: function(element) {
                $(element).closest('.form-group').removeClass('has-error');
            },
            errorPlacement: function(error) {
                $("#change_password_modal_server_error_message").html("");
                $(".change-password-alert-danger").append(error);
            }
        });
    }

    // 弹出修改密码模态框
    function changePassword() {
        $("#change_password_modal").modal("show");
    }

    // 提交修改密码请求
    function changePasswordSubmit() {
        var check = $("#change_password_modal_form").validate().form();
        if ( ! check) {
            return;
        }
        $.ajax({
            url: "${ctx}/change-password",
            method: "POST",
            dataType: "json",
            data: {
                oldPassword: $("#old_password").val(),
                newPassword: $("#new_password").val()
            },
            success: function(baseModel) {
                if (baseModel.hasError) {
                    $(".change-password-alert-danger").removeClass("display-hide");
                    $(".change-password-alert-danger").css("display", "block");
                    $("#change_password_modal_server_error_message").html('<label class="error">' + baseModel.errorMessage + '</label>');
                } else {
                    $("#old_password").val("");
                    $("#new_password").val("");
                    $("#new_password2").val("");
                    $("#change_password_modal").modal("hide");
                    toastr.success("修改成功");
                }
            },
            error: function() {
                bootbox.alert("网络错误，请刷新后重试。");
            }
        });
    }

    function noticeUnconfirmedOrder() {
        $.ajax({
            url: "${ctx}/notice-unconfirmed-order",
            method: "GET",
            dataType: "json",
            success: function(result) {
                var total = result.hotel + result.product;
                if (total > 0) {
                    $("#header_notification_bar").removeClass("hidden");
                    $("#unconfirmed_order_count").html(total);

                    if (result.hotel > 0) {
                        $("#notice_hotel_order").removeClass("hidden").find(".badge-default").html(result.hotel);
                    }
                    if (result.product > 0) {
                        $("#notice_product_order").removeClass("hidden").find(".badge-default").html(result.product);
                    }
                }
            }
        });
        setTimeout("noticeUnconfirmedOrder()", 60000);
    }

    function confirmOrderNotice(self) {
        var number = $(self).parent().find(".badge-default").text();
        number = $("#unconfirmed_order_count").text() - number;
        $("#unconfirmed_order_count").html(number);
        if (number < 1) {
            $("#header_notification_bar").addClass("hidden");
        }
        $(self).parent().parent().remove();
    }

    toastr.options = {
        "timeOut": "2000",
        "positionClass": "toast-top-right"
    };
</script>

</body>
</html>



